package net.seratch.taskun.scheduler.config;

import java.util.HashMap;
import java.util.Map;

/**
 * Configuration on taskun-scheduler
 * 
 * @author Kazuhiro Sera
 */
public class SchedulerConfig {

	/**
	 * Invoke scheduler or not
	 */
	public boolean enableInvokingScheduler = true;

	/**
	 * Logging each invocation of cron daemon
	 */
	public boolean enableLoggingForEachCrondInvocation = false;

	/**
	 * Named server hostnames
	 */
	public Map<String, String> namedServers = new HashMap<String, String>();

	/**
	 * Add or update named a server configuration.
	 * 
	 * @param name
	 *            server name
	 * @param hostname
	 *            hostname
	 */
	public void putNamedServer(String name, String hostname) {
		namedServers.put(name, hostname);
	}

	/**
	 * Delete a named server configuration.
	 * 
	 * @param name
	 *            server name
	 */
	public void removeNamedServer(String name) {
		namedServers.remove(name);
	}

	/**
	 * Get a configuration of named server
	 * 
	 * @param name
	 *            server name
	 * @return hostname
	 */
	public String getNamedServerHostname(String name) {
		return namedServers.get(name);
	}
}
